home *** CD-ROM | disk | FTP | other *** search
- on mouseDown me
- set xCenter to the locH of sprite 3
- set yCenter to the locV of sprite 3
- set radius to the width of sprite 4 / 2
- set the cursor of sprite the spriteNum of me to [member "Closed Hand", member "Closed Hand Mask"]
- repeat while the stillDown
- set mx to the mouseH
- set my to the mouseV
- set xAtMouse to mx - xCenter
- set yAtMouse to my - yCenter
- if xAtMouse <> 0 then
- set angleAtMouse to atan(float(abs(yAtMouse)) / float(abs(xAtMouse)))
- if angleAtMouse = 0 then
- set yAtCircle to 0
- set xAtCircle to radius * (xAtMouse / abs(xAtMouse))
- else
- set yAtCircle to sin(angleAtMouse) * float(radius) * (yAtMouse / abs(yAtMouse))
- set xAtCircle to cos(angleAtMouse) * float(radius) * (xAtMouse / abs(xAtMouse))
- end if
- else
- set xAtCircle to 0
- if yAtMouse <> 0 then
- set yAtCircle to radius * (yAtMouse / abs(yAtMouse))
- else
- set yAtCircle to radius
- end if
- end if
- set the locH of sprite the clickOn to xCenter + xAtCircle
- set the locV of sprite the clickOn to yCenter + yAtCircle
- drawLine(5, yCenter, xCenter, the locV of sprite the clickOn, the locH of sprite the clickOn)
- set dy to float(yCenter - the locV of sprite the clickOn)
- set dy to -dy
- set dx to float(xCenter - the locH of sprite the clickOn)
- if dx = 0 then
- if dy < 0 then
- set theta1 to float(1.5 * PI)
- else
- set theta1 to float(PI / 2.0)
- end if
- else
- if dx > 0 then
- set theta1 to float(atan(float(dy / dx)))
- if theta1 < 0 then
- set theta1 to float(theta1) + (2.0 * PI)
- end if
- else
- set theta1 to float(atan(float(dy / dx))) + PI
- end if
- end if
- set the floatPrecision to 2
- if theta1 > PI then
- set theta1 to theta1 - PI
- else
- set theta1 to theta1 + PI
- end if
- set tempT to theta1 * 180.0 / PI
- put float(1.0 * float(cos(theta1))) into field "X1"
- set Y1temp to float(1.0 * float(sin(theta1)))
- put "(" & field "X1" & "," & Y1temp & ")" into field "x-y"
- if value(field "X1") = 0 then
- put "Undef." into field "Y1"
- else
- put float(1.0 * float(tan(theta1))) into field "Y1"
- end if
- set x0 to the locH of sprite 15
- set y0 to the locV of sprite 15
- if (field "theta" <> 90.0) or (field "theta" <> 270.0) then
- set the locH of sprite 19 to (0.80000000000000004 * tempT) + x0
- set the locV of sprite 19 to y0 - (50 * tan(theta1))
- end if
- if the hilite of cast "Degrees" then
- put theta1 * 180.0 / PI into field "theta"
- else
- put theta1 into field "theta"
- end if
- updateStage()
- end repeat
- set the cursor of sprite the spriteNum of me to [member "Hand", member "Hand Mask"]
- end
-
- on beginSprite
- initializeCircle()
- set the hilite of cast "Degrees" to 1
- set the hilite of cast "Radians" to 0
- set the castNum of sprite 16 to cast "Degs"
- put "(1.00, 0.02)" into field "x-y"
- put "0.02" into field "Y1"
- end
-